﻿using System;
using UnityEngine;
using UnityEngine.Networking;

// Token: 0x02000322 RID: 802
public class ResizeCharacter : NetworkBehaviour
{
	// Token: 0x0600149F RID: 5279 RVA: 0x00087D7D File Offset: 0x00085F7D
	private void GetInput()
	{
		if (!GameController.playerInputEnabled)
		{
			return;
		}
		this.sizeUp = Input.GetButton(ButtonInput.SizeUp);
		this.sizeDown = Input.GetButton(ButtonInput.SizeDown);
	}

	// Token: 0x060014A0 RID: 5280 RVA: 0x00087DAA File Offset: 0x00085FAA
	private void Awake()
	{
		this.entity = base.GetComponent<EntityBase>();
		if (this.entity.isGiantess)
		{
			this.scaleModifier = 1000f;
		}
		else
		{
			this.scaleModifier = 1f;
		}
	}

	// Token: 0x060014A1 RID: 5281 RVA: 0x00087DE4 File Offset: 0x00085FE4
	private void Update()
	{
		if (base.hasAuthority)
		{
			this.GetInput();
			if (this.sizeUp)
			{
				this.ChangeScale(this.entity.Scale * (1f + this.sizeChangeRate * Time.deltaTime));
			}
			else if (this.sizeDown)
			{
				this.ChangeScale(this.entity.Scale * (1f - this.sizeChangeRate * Time.deltaTime));
			}
		}
	}

	// Token: 0x060014A2 RID: 5282 RVA: 0x00087E68 File Offset: 0x00086068
	public void ChangeScale(float scale)
	{
		if (this.entity == null)
		{
			this.entity = base.GetComponent<EntityBase>();
		}
		if (scale < ResizeCharacter.minSize / this.scaleModifier)
		{
			scale = ResizeCharacter.minSize / this.scaleModifier;
		}
		else if (scale > ResizeCharacter.maxSize / this.scaleModifier)
		{
			scale = ResizeCharacter.maxSize / this.scaleModifier;
		}
		this.entity.ChangeScale(scale);
	}

	// Token: 0x060014A4 RID: 5284 RVA: 0x00002973 File Offset: 0x00000B73
	private void UNetVersion()
	{
	}

	// Token: 0x060014A5 RID: 5285 RVA: 0x00087EFC File Offset: 0x000860FC
	public override bool OnSerialize(NetworkWriter writer, bool forceAll)
	{
		bool result;
		return result;
	}

	// Token: 0x060014A6 RID: 5286 RVA: 0x00002973 File Offset: 0x00000B73
	public override void OnDeserialize(NetworkReader reader, bool initialState)
	{
	}

	// Token: 0x0400179F RID: 6047
	private EntityBase entity;

	// Token: 0x040017A0 RID: 6048
	public float scaleModifier = 1f;

	// Token: 0x040017A1 RID: 6049
	public static float maxSize = 1000f;

	// Token: 0x040017A2 RID: 6050
	public static float minSize = 0.001f;

	// Token: 0x040017A3 RID: 6051
	private bool sizeUp;

	// Token: 0x040017A4 RID: 6052
	private bool sizeDown;

	// Token: 0x040017A5 RID: 6053
	public float sizeChangeRate = 0.7f;
}
